<?php
class RoleAction extends CommonAction{
   function getstudent(){
       $this->ajaxReturn('dsfdsfdsfsd');
   }
   
   function get_list($model,$map,$order,$sort,$p)
   {
       return $model->where($map)->order('sort_order')->limit($p->firstRow . ',' . $p->listRows)->select();
   }
   
   function add(){
       $model = D('Role');
       $res = $model->order('sort_order')->select();
       $this->assign('list', $res);
       CommonAction::add();
   }
   
   function edit(){
       $id = $_REQUEST['id'];
       $model = D('Role');
       $res = $model->order('sort_order')->where('id <> '.$id)->select();
       $this->assign('list', $res);
       CommonAction::edit();
   }
   
   function save(){
       $includeids = '';
       $description = '';
       $model = D('Role');
       if (is_array($_POST['chkRole'])){
           foreach ($_POST['chkRole'] as $row){
               $includeids.=$row.',';
               $description.=$model->where('id='.$row)->getField('mc').',';
           }
           $_POST['includeids'] = $includeids;
           $_POST['description'] = $description;
       }
       CommonAction::save();
   }
}

?>
